package cn.jszx.core.bean.user;

import java.io.Serializable;
import java.util.Date;


public class User implements Serializable {
    /**
     * 序列化ID
     */
    private static final long serialVersionUID = 1L;

    private String username;
    private String password;
    private Gender gender;
    private String email;
    private String realName;
    private Date registerTime;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Date getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", gender=" + gender +
                ", email='" + email + '\'' +
                ", realName='" + realName + '\'' +
                ", registerTime=" + registerTime +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof User)) return false;

        User user = (User) o;

        if (username != null ? !username.equals(user.username) : user.username != null) return false;
        if (password != null ? !password.equals(user.password) : user.password != null) return false;
        if (gender != user.gender) return false;
        if (email != null ? !email.equals(user.email) : user.email != null) return false;
        if (realName != null ? !realName.equals(user.realName) : user.realName != null) return false;
        return !(registerTime != null ? !registerTime.equals(user.registerTime) : user.registerTime != null);

    }

    @Override
    public int hashCode() {
        int result = username != null ? username.hashCode() : 0;
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (gender != null ? gender.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (realName != null ? realName.hashCode() : 0);
        result = 31 * result + (registerTime != null ? registerTime.hashCode() : 0);
        return result;
    }

    public enum Gender {

        MAN {
            public String getName() {
                return "男";
            }
        },
        WOMAN {
            public String getName() {
                return "女";
            }
        },
        SECRECY {
            public String getName() {
                return "保密";
            }
        };

        public abstract String getName();
    }
}
